#!/bin/sh

TOMCAT_NAME='tomcat'

MONITER_NAME='monitorTomcat.sh'

time=`date +%F--%T`

remote_host=`ifconfig | grep inet | grep -v '10.134' | grep -v '127.0' |awk '{print $2}'`


TOMCAT_PID=`ps -ef | grep "$TOMCAT_NAME" | grep -v "$0" | grep -v "grep" | grep -v "tail" | awk '{print $2}'`

MONITER_PID=`ps -ef | grep "$MONITER_NAME" | grep -v "$0" | grep -v "grep" | grep -v "tail" | awk '{print $2}'`


echo 'TOMCAT_PID = '$TOMCAT_PID

echo 'MONITER_PID = '$MONITER_PID

echo '当前时间：'$time',结束服务器'$remote_host'TOMCAT进程:'$TOMCAT_PID',监测进程：'$MONITER_PID

kill -9 $MONITER_PID

kill -9 $TOMCAT_PID

  
